package com.hiyee.api.controller.files;

import com.hiyee.grace.result.ResponseJsonResult;
import com.hiyee.pojo.bo.UpdateAdminUserBO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Api(value = "文件上传控制器", tags = {"文件上传控制器"})
@RequestMapping("file")
public interface FileUploadControllerApi {

    @ApiOperation(value = "上传用户头像", notes = "上传用户头像", httpMethod = "POST")
    @PostMapping("/uploadFace")
    public ResponseJsonResult uploadFace(@RequestParam String userId, MultipartFile file) throws Exception;

    @ApiOperation(value = "服务内部http请求测试", notes = "服务内部http请求测试", httpMethod = "GET")
    @GetMapping("/getFile")
    public ResponseJsonResult getFile();

    @ApiOperation(value = "上传到mongoDBGridFS", notes = "上传到mongoDBGridFS", httpMethod = "POST")
    @PostMapping("/uploadToGridFS")
    public ResponseJsonResult uploadGridFS(@RequestBody UpdateAdminUserBO updateAdminUserBO) throws Exception;

    @ApiOperation(value = "读取mongoDB图片", notes = "读取mongoDB图片", httpMethod = "GET")
    @GetMapping("/readInGridFS")
    public void readInGridFS(@RequestParam String faceId, HttpServletRequest request, HttpServletResponse response) throws Exception;

    @ApiOperation(value = "多文件上传", notes = "多文件上传", httpMethod = "POST")
    @PostMapping("/uploadFiles")
    public ResponseJsonResult uploadFiles(@RequestParam String userId, MultipartFile[] files) throws Exception;

    @GetMapping("/eurekaFiles")
    public ResponseJsonResult eurekaFiles();
}
